package com;

import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport {
	private String account;
	private String password;

	public String getAccount() {
		return account;
	}

	public void setAccount(String account) {
		this.account = account;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String execute() {
		System.out.println("account=" + account);
		System.out.println("LoginAction: execute() is called!");
		return "success";
	}

	public String regist() {
		System.out.println("account=" + account);
		System.out.println("LoginAction: regist() is called!");
		return "success";
	}

	public void validate() {
		System.out.println("LoginAction: validate() is called!");
		if (account == null || account.equals("")) {
			System.out.println("xx");
			this.addFieldError("account", "请输入您的用户名！");
		}
		if (password == null || password.equals("")) {
			this.addFieldError("password", "请输入您的密码！");
		}
	}

	public void validateRegist() {
		System.out.println("LoginAction: validateRegist() is called!");
	}
}
